load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("scm_client_infra")

cpp_unittest(
    name = "test",
    srcs = glob(
        ["*Test.cpp"],
    ),
    args = [
        # Require all tests to set hgPath and not default to system hg.
        "--hgPath",
        "false",
    ],
    compatible_with = [
        "ovr_config//os:linux",
        "ovr_config//os:macos",
    ],
    env = {
        "EDEN_HG_BINARY": "$(location //scm/telemetry/hg:hg)",
        "HGEXECUTABLEPATH": "$(location //eden/scm:hg)",
        "HG_REAL_BIN": "$(location //eden/scm:hg)",
    },
    supports_static_listing = False,
    deps = [
        "fbsource//third-party/googletest:gmock",
        "fbsource//third-party/googletest:gtest",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/telemetry:telemetry",
        "//eden/common/utils:fault_injector",
        "//eden/common/utils:path",
        "//eden/common/utils:utils",
        "//eden/fs/config:config",
        "//eden/fs/model:model",
        "//eden/fs/model:testutil",
        "//eden/fs/store:context",
        "//eden/fs/store:store",
        "//eden/fs/store/hg:hg_proxy_hash",
        "//eden/fs/store/hg:sapling_backing_store",
        "//eden/fs/store/hg:sapling_backing_store_options",
        "//eden/fs/store/hg:sapling_import_request",
        "//eden/fs/store/hg:sapling_import_request_queue",
        "//eden/fs/telemetry:stats",
        "//eden/fs/testharness:hg_repo",
        "//eden/fs/testharness:test_config_source",
        "//folly:range",
        "//folly:try",
        "//folly/executors:cpu_thread_pool_executor",
        "//folly/logging:logging",
        "//folly/testing:test_util",
    ],
)

cpp_benchmark(
    name = "bench",
    srcs = glob(["*Benchmark.cpp"]),
    compatible_with = [
        "ovr_config//os:linux",
        "ovr_config//os:macos",
    ],
    deps = [
        "//eden/common/utils:utils",
        "//eden/common/utils/benchharness:benchharness",
        "//eden/fs/config:config",
        "//eden/fs/store:context",
        "//eden/fs/store/hg:sapling_import_request",
        "//eden/fs/store/hg:sapling_import_request_queue",
    ],
)
